<!--  -->
<template>
  <div class='gift-page'>
    <c-title :hide="false" text="组合套餐列表"></c-title>
    <div class="mb-10"></div>
    <div  :class="[pageTemplate?'goods-container':'']">
      <div class="goods-List" 
        v-for="(item,index) in giftList" 
        :key="index"  @click.stop="showGoodPup(item.goods.id)" 
        :style="{'margin-bottom': pageTemplate? '0':'0.625rem'}"
        :class="[pageTemplate?'content-page':'']"
        >
        <div class="flex">
          <div class="goods-info">
            <div class="info_a" >
            <div class="img" >
              <van-image
                width="96px"
                height="96px"
                radius="8px"
                :src="item.goods && item.goods.thumb"
              />
              </div>
              <ul class="info">
                <li class="name" style="-webkit-box-orient: vertical;" :class="pageTemplate?'name-pg':''">
                  {{ item.goods && item.goods.title }}
                </li>
                <div class="flex-j-sb price-box">
                  <li class="price" v-if="!pageTemplate">
                    <span class="left"
                      ><font>{{$i18n.t('money')}}</font>{{ item.goods.price }}</span
                    ><span class="right" v-show="parseInt(item.goods.market_price)">{{$i18n.t('money')}}{{ item.goods.market_price }}</span>
                  </li>
                </div>
              </ul>
            </div>
          </div>
        </div>
        <div class="goods-specs flex-a-c flex-j-sb"  v-if="item.goods && item.goods.has_option == 1 && !pageTemplate" @click="goodsSpescOn(item.goods)">
          <h4 >规格</h4>
          <div class="specs-title">
            <span>{{item.goods.optionName || '请选择'}}</span>
            <span class="iconfont icon-icon_more1"></span>
          </div>
        </div>
        <div class="goods-line" v-if="pageTemplate"></div>
      </div>
    </div>
    
    <div class="mb-70"></div>
    <div class="fixed" :class="pageTemplate?'fixed-exchange':''">
        <p class="price" v-if="!pageTemplate">
          合计：<span ><span class="money">{{$i18n.t('money')}}</span>{{ totalPrice }}</span>
        </p>
      <button type="button" class="buyBtn" :class="pageTemplate?'exchange':''"  @click="submitGoods">{{pageTemplate?'立即兑换':'立即购买'}}</button>
    </div>
    <!--商品规格-->
    <template>
      <yz-specs :goodsInfo="goodData" v-model="popupSpecs" v-on:closeSpecsPopup="close_yz_specs_popup"> </yz-specs>
    </template>
    <!-- 商品详情页弹窗 -->
    <yzGoodsPopup v-model="showgp" :goodsInfo="goodinfo" :addCartBtn='false' :roundShow="true" :showPrice="!pageTemplate"></yzGoodsPopup>
  </div>
</template>

<script>
import giftGoods_controller from "./giftGoods_controller";
export default giftGoods_controller;
</script>
<style lang="scss" scoped>
/* @import url(); 引入公共css类 */
.name-pg {
  padding:0.875rem 0 0 0;
}
.gift-page {
  .mb-10 {
    height: 0.625rem;
    clear:both;
  }
  .mb-70 {
    height: 4.375rem;
    clear: both;
  }
  .goods-List {
    display: flex;
    flex-direction: column;
    background: #fff;
    margin: 0 0.75rem;
    border-radius: 0.5rem 0.5rem 0.5rem 0.5rem;
    .goods-info {
      padding:0.625rem;
      .info_a {
        display: flex;
        // padding:1.25rem 0 0 0;
        .img {
          width: 6rem;
          height: 6rem;
          overflow: hidden;
          background: #f5f5f5;
          margin-right: 0.625rem;
          border-radius: 0.5rem 0.5rem 0.5rem 0.5rem;
          img {
            width: 100%;
          }
        }

        .info {
          width: 12.625rem;
          text-align: left;
          padding:0 0.75rem 0 0;
          box-sizing: border-box;

          .name {
            // font-size: 32rpx;
            // max-height: 2.5rem;
            // line-height: 1.25rem;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;

            font-size: 0.875rem;
            line-height: 1.125rem;
            font-weight: 500;
            color: #00001C;
          }
          .price-box {
            padding:0.75rem 0 0 0;
          }
          .price {
            // line-height: 1.875rem;
            span {
              display: block;
            }
            
            font-size: 1rem;
            color: var(--themeBaseColor);
            line-height: 36rpx;

            .left {
              color: var(--themeBaseColor);
              font-size: 1rem;
              font-weight: bold;
              margin-right: 0.625rem;

              font {
                font-size: 0.75rem;
              }
            }

            .right {
              color: #8c8c8c;
              font-size: 0.75rem;
              text-decoration: line-through;
            }
          }

          .member {
            display: flex;
            align-items: flex-end;
            justify-content: space-between;
            span {
              font-size: 1rem;
              line-height: 1rem;
            }
          }
        }
        .info-pm {
          padding:0;
        }
      }
      .info-page {
        padding: 0.9375rem 0 0 0.75rem;
      }
    }
    .goods-specs {
      padding:1.125rem 0rem 1.25rem 0;
      margin:0 0.9375rem 0 2.125rem;
      border-bottom: 0.0625rem solid #F0F0F1;
      cursor: pointer;
      h4 {
        font-weight: 500;
        color: #00001C;
        font-size: 0.875rem;
      }
      .specs-title {
        font-size: 0.8125rem;
        font-weight: 400;
        color: #6E6E79;
        &:last-child {
          font-size: 0.8125rem;
          color: #6E6E79;
        }
        .icon-icon_more1 {
          color:#AAAAB3;
          font-size: 0.8125rem;
        }
      }
    }
    .goods-line {
      border-bottom: 0.0625rem solid #F0F0F1;
      margin:0 0.75rem 0 0.75rem;
      padding:0.9375rem 0rem 0rem 0;
    }
  }
  .content-page {
    padding:0;
    border-radius:0rem;
    &:last-child {
      border-radius: 0rem 0rem 0.5rem 0.5rem;
        
    }
    &:first-child {
      border-radius: 0.5rem 0.5rem 0rem 0rem ;
    }
  }
  .goods-container {
    .goods-List {
      &:last-child {
        .goods-line {
          border-bottom:none;
        }
      }
    }
  }
  &:last-child {
    .goods-List {
        &:last-child {
        .specs-40 {
          height: 0.9375rem;
          clear: both;
        }
      }
    }
  }
  .fixed {
    position: fixed;
    bottom: 0;
    width: 23.4375rem;
    height: 3.0625rem;
    line-height: 3.0625rem;
    background: #fff;
    box-shadow: 0 -0.0625rem 0.25rem rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: flex-end;
    z-index: 12;
    .favourable {
      position: absolute;
      left: 0.625rem;
    }
    .buyBtn {
      padding: 0.8125rem 1.75rem;
      line-height: 0.9375rem;
      border-radius: 1.3125rem 1.3125rem 1.3125rem 1.3125rem;
      background: var(--themeBaseColor);;
      font-size: 0.9375rem;
      // height: 1.625rem;
      display: flex;
      justify-content: center;
      align-self: center;
      border: solid 0.0313rem var(--themeBaseColor);;
      color: #fff;
      margin-right: 0.625rem;
      cursor: pointer;
    }
    .price {
      display: flex;
      align-items: center;
      padding-right: 0.625rem;
      font-size: 0.875rem;

      span {
        font-size: 1.125rem;
        color: var(--themeBaseColor);
        font {
          font-size: 0.875rem;
        }
      }
      .money {
        font-size: 0.75rem;
      }
    }
  }
  .fixed-exchange {
    justify-content:flex-start;
  }
  .exchange {
    width: 21.875rem;
    margin:0 0.75rem;
  }
}
</style>